from django.contrib.auth.decorators import login_required
from django.urls import path
from django.views.decorators.csrf import csrf_exempt

from . import views

urlpatterns = [
    path('', views.IndexView.as_view(), name='index'),
    path('article/', views.ArticleListView.as_view(), name='article-list'),
    path('p/<int:pk>.html', views.ArticleDetailView.as_view(), name='article-detail'),
    path('article/<int:category_id>/', views.ArticleListByCategoryView.as_view(), name='article-list-by-category'),

    path('article/comment/', views.ArticleCommentPubView.as_view(), name='article-comment-pub'),
    path('article/up/', views.ArticleUpView.as_view(), name='article-up'),
    path('article/comment/list/', views.ArticleCommentListView.as_view(), name='article-comment-list'),

    path('search/', views.SearchListView.as_view(), name='search'),

    path('links/', views.LinkView.as_view(), name='links'),
    path('about/', views.AboutView.as_view(), name='about'),
    path('archive/', views.ArchiveView.as_view(), name='archive'),

    path('diary/', login_required(views.DiaryView.as_view()), name='diary'),
    path('message/', login_required(views.MessageView.as_view()), name='message'),

    path('upload/', csrf_exempt(views.UploadView.as_view()), name='upload'),
]
